package com.zy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.domain.ProdComm;
import com.zy.service.ProdCommService;
import com.zy.mapper.ProdCommMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
* @author RASH_ZY
* @description 针对表【prod_comm(商品评论)】的数据库操作Service实现
* @createDate 2025-04-02 11:54:04
*/
@Service
public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm>
    implements ProdCommService{

    @Autowired
    private ProdCommMapper prodCommMapper;

    /**
     * 编辑评论(回复和审核商品评论)
     * @param prodComm
     * @return
     */
    @Override
    public Boolean replyAndExamineProdComm(ProdComm prodComm) {
        //获取评论内容
        String replyContent = prodComm.getContent();
        //有评论内容，
        if (StringUtils.hasText(replyContent)) {
            //设置回复时间、回复状态
            prodComm.setReplyTime(new Date());
            prodComm.setReplySts(1);
        }
        //编辑评论(回复和审核商品评论)
        return prodCommMapper.updateById(prodComm)>0;
    }
}




